.root {
  --carousel-height: auto;
  position: relative;
}

.viewport {
  height: var(--carousel-height);
  overflow: hidden;

  &[data-type='container'] {
    container: carousel / inline-size;
  }
}

.container {
  display: flex;
  flex-direction: row;
  height: var(--carousel-height);

  :where([data-include-gap-in-size]) & {
    &:where([data-orientation='vertical']) {
      margin-bottom: calc(var(--carousel-slide-gap) * -1);
    }

    &:where([data-orientation='horizontal']) {
      margin-inline-end: calc(var(--carousel-slide-gap) * -1);
    }
  }

  &:where([data-orientation='vertical']) {
    flex-direction: column;
  }
}

.controls {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1;
  pointer-events: none;

  &:where([data-orientation='vertical']) {
    inset-inline-start: calc(50% - var(--carousel-control-size) / 2);
    top: 0;
    bottom: 0;
    flex-direction: column;
    padding: var(--carousel-controls-offset) 0;
  }

  &:where([data-orientation='horizontal']) {
    inset-inline-start: 0;
    inset-inline-end: 0;
    top: calc(50% - var(--carousel-control-size) / 2);
    flex-direction: row;
    padding: 0 var(--carousel-controls-offset);
  }
}

.control {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: var(--carousel-control-size);
  min-height: var(--carousel-control-size);
  border-radius: var(--carousel-control-size);
  pointer-events: all;
  background-color: var(--mantine-color-white);
  color: var(--mantine-color-black);
  box-shadow: var(--mantine-shadow-md);
  border: 1px solid var(--mantine-color-gray-3);
  transition: opacity 100ms ease;

  @mixin where-light {
    opacity: 0.85;
  }

  @mixin where-dark {
    opacity: 0.65;
  }

  @mixin hover {
    opacity: 1;
  }
}

.indicators {
  position: absolute;
  display: flex;
  justify-content: center;
  gap: 8px;
  pointer-events: none;

  &:where([data-orientation='vertical']) {
    bottom: 0;
    top: 0;
    inset-inline-end: var(--mantine-spacing-md);
    flex-direction: column;
  }

  &:where([data-orientation='horizontal']) {
    bottom: var(--mantine-spacing-md);
    inset-inline-start: 0;
    inset-inline-end: 0;
    flex-direction: row;
  }
}

.indicator {
  pointer-events: all;
  border-radius: var(--mantine-radius-xl);
  box-shadow: var(--mantine-shadow-sm);
  opacity: 0.6;
  background-color: var(--mantine-color-white);

  @mixin hover {
    opacity: 1;
  }

  &:where([data-active]) {
    opacity: 1;
  }

  &:where([data-orientation='vertical']) {
    width: 5px;
    height: 25px;
  }

  &:where([data-orientation='horizontal']) {
    width: 25px;
    height: 5px;
  }
}

.slide {
  position: relative;
  flex: 0 0 var(--carousel-slide-size, 100%);

  .root:where([data-include-gap-in-size]) & {
    &:where([data-orientation='vertical']) {
      padding-bottom: var(--carousel-slide-gap);
    }

    &:where([data-orientation='horizontal']) {
      padding-inline-end: var(--carousel-slide-gap);
    }
  }

  .root:where(:not([data-include-gap-in-size])) & {
    &:where([data-orientation='vertical']) {
      margin-bottom: var(--carousel-slide-gap);
    }

    &:where([data-orientation='horizontal']) {
      margin-inline-end: var(--carousel-slide-gap);
    }
  }
}
